﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
using DAL;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {

          
        
            IHangHoaRepository hh = new HangHoaRepository();
            DoiTuongThongKe dt;
            List<DoiTuongThongKe> dstk = new List<DoiTuongThongKe>();
            List<IGrouping<string, HangHoa>> ds = hh.GetAll().GroupBy(x => x.NhaCC).ToList();
            foreach (var item in hh.GetAll().GroupBy(x => x.NhaCC).ToList())
            {
                dt = new DoiTuongThongKe();
                dt.MaHH = item.Key;
                dt.SoLuong = item.Sum(x => x.SoLuong);
                dstk.Add(dt);
                 

            }
            foreach (var item in dstk)
                Console.WriteLine(item.SoLuong);
           
         
            
            Console.ReadLine();
        }
    }
}
